package com.doit.day01;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;
import java.util.List;

public class _03_监听器 {
    public static void main(String[] args) throws Exception {
        ZooKeeper zk = new ZooKeeper("linux01:2181", 2000, new Watcher() {
            @Override
            public void process(WatchedEvent event) {
                System.out.println("没有什么业务逻辑，单纯的把监听器打开了");

            }
        });


        zk.getChildren("/", new Watcher() {
            @Override
            public void process(WatchedEvent event) {
                //你到底在监听什么？
                System.out.println("呵呵");
                //主要的业务逻辑
            }
        });

        Thread.sleep(Long.MAX_VALUE);






    }
}
